<script setup lang="ts">
import { ref, onMounted } from "@vue/runtime-core"
import { useRouter } from "vue-router"
import Toast from "vant/lib/toast";
import 'vant/es/toast/style';

const show = ref(false)
const router = useRouter()
const login = ref('')
const st = ref('')

const goLogin = () => {
  show.value = true
  router.push({ path: '/login' })
}

const loginOrno = () => {
  const log = (localStorage.getItem('s') || '')
  login.value = log
  if (login.value == "true") {
    show.value = true
  } else {
    show.value = false
  }
}

const isShow = () => {
  show.value = false
  st.value = 'false'
  localStorage.setItem('s', st.value)
  Toast('注销成功')
}

onMounted(() => {
  loginOrno()
})

</script>



<template>
  <div class="about">
    <div class="emplace">
      <div class="emplace-img"><img src="@/assets/img/setup.png" alt="" /></div>
      <div class="message-split">
        <div class="message"><img src="@/assets/img/news.png" alt="" /></div>
        <div class="split"><img src="@/assets/img/forward.png" alt="" /></div>
      </div>
    </div>

    <div class="user-infor">
      <div class="user-item">
        <div class="user-img" v-if="show"><img src="@/assets/liveimg/01.jpg" alt="" /></div>
        <div class="user-img" v-else><img src="@/assets/img/R-C.png" alt="" /></div>

        <div class="user-title" v-if="show">杰米10086</div>
        <div class="user-title" v-else @click="goLogin()">立即登录</div>

      </div>
    </div>

    <div class="personal-information">
      <div class="personal-infor">
        <div class="personal-information-img">
          <img src="@/assets/img/Personal-homepage.png" alt="" />
        </div>
        <div class="personal-infor-title">个人主页</div>
      </div>

      <div class="personal-infor">
        <div class="personal-information-img">
          <img src="@/assets/img/MemberCenter.png" alt="" />
        </div>
        <div class="personal-infor-title">会员中心</div>
      </div>

      <div class="personal-infor" @click="$router.push({ path: '/comment' })">
        <div class="personal-information-img">
          <img src="@/assets/img/Collection.png" alt="" />
        </div>
        <div class="personal-infor-title">收藏</div>
      </div>

      <div class="personal-infor">
        <div class="personal-information-img">
          <img src="@/assets/img/follow.png" alt="" />
        </div>
        <div class="personal-infor-title">关注</div>
      </div>

      <div class="personal-infor">
        <div class="personal-information-img">
          <img src="@/assets/img/footprint.png" alt="" />
        </div>
        <div class="personal-infor-title">足迹</div>
      </div>
    </div>

    <div class="cart-section">
      <div class="section-link" @click="$router.push({path:'/cart'})">购物车</div>
      <div class="section-title">
        <div class="section-item">
          <div class="section-item-name">卡卷红包</div>
          <div class="section-item-desc">7张活动卷></div>
        </div>
        <div class="section-item">
          <div class="section-item-name">补贴保障</div>
          <div class="section-item-desc">速贷补运费></div>
        </div>
        <div class="section-item">
          <div class="section-item-name">我的钱包</div>
          <div class="section-item-desc">查看白付美></div>
        </div>
      </div>
    </div>

    <div class="My-Order">
      <div class="indent">
        <div>我的订单</div>
        <div @click="$router.push({path:'/dingdan'})">全部></div>
      </div>

      <div class="big-oreder">
        <div class="indent-oreder">
          <div class="indent-img">
            <img src="@/assets/img/money.png" alt="" />
          </div>
          <div>待付款</div>
        </div>
        <div class="indent-oreder">
          <div class="indent-img">
            <img src="@/assets/img/sc.png" alt="" />
          </div>
          <div>待发货</div>
        </div>

        <div class="indent-oreder">
          <div class="indent-img">
            <img src="@/assets/img/car.png" alt="" />
          </div>
          <div>待收货</div>
        </div>

        <div class="indent-oreder">
          <div class="indent-img">
            <img src="@/assets/img/pj.png" alt="" />
          </div>
          <div>评价</div>
        </div>

        <div class="indent-oreder">
          <div class="indent-img">
            <img src="@/assets/img/tuikuan.png" alt="" />
          </div>
          <div>退款售后</div>
        </div>
      </div>
    </div>
    <div class="remo" v-if="show" @click="isShow()">注销登录</div>
  </div>
</template>

<style lang="scss" scoped>
.about {
  background-color: #f5f5f5;
  user-select: none;
  height: 100vh;

  .emplace {
    display: flex;
    justify-content: space-between;
    padding: 5px 10px;

    .emplace-img {
      img {
        display: block;
        width: 20px;
        height: 20px;
      }
    }

    .message-split {
      display: flex;

      .split {
        img {
          display: block;
          width: 20px;
          height: 20px;
        }
      }

      .message {
        img {
          display: block;
          width: 20px;
          height: 20px;
        }
      }
    }
  }

  .user-infor {
    .user-item {
      display: flex;
      align-items: center;
      padding-top: 20px;
      margin-left: 15px;

      .user-img {
        width: 50px;
        height: 50px;

        img {
          display: block;
          width: 100%;
          border-radius: 50%;
        }
      }

      .user-title {
        margin-left: 15px;
      }
    }
  }

  .personal-information {
    margin-top: 15px;
    display: flex;
    justify-content: space-around;

    .personal-infor {
      display: flex;
      flex-direction: column;
      align-items: center;

      .personal-information-img {
        width: 24px;
        height: 24px;

        img {
          display: block;
          width: 100%;
        }
      }

      .personal-infor-title {
        margin-top: 5px;
        text-align: center;
        font-size: 12px;
      }
    }
  }

  .cart-section {
    margin-top: 10px;
    display: flex;

    .section-link {
      margin-left: 20px;
      width: 160px;
      height: 115px;
      background-image: url(@/assets/img/shoppingcart.png);
      background-size: 100% 100%;
      margin-right: 15px;
    }

    .section-title {
      width: 160px;
      height: 115px;
      background-color: #fff;
      border-radius: 5px;

      .section-item {
        display: flex;
        justify-content: space-between;
        margin-top: 10px;
        padding-left: 5px;
        padding-right: 10px;
        font-weight: 600;
        padding-bottom: 7px;
        border-bottom: 2px solid #eee;

        &:last-child {
          border-bottom: 0;
        }

        .section-item-name {
          font-size: 14px;
          color: #333;
        }

        .section-item-desc {
          font-size: 12px;
          color: #999;
        }
      }
    }
  }

  .My-Order {
    // margin-top: 10px;
    margin: 10px;
    background-color: #fff;
    height: 100px;

    .indent {
      padding: 10px;
      display: flex;
      justify-content: space-between;
    }

    .big-oreder {
      margin-top: 5px;
      display: flex;
      justify-content: space-around;
      border-radius: 10px;

      .indent-oreder {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;

        .indent-img {
          width: 30px;
          height: 30px;

          img {
            display: block;
            width: 100%;
          }
        }
      }
    }
  }
}

.remo {
  width: 160px;
  height: 45px;
  line-height: 45px;
  margin: 40px auto;
  background-image: linear-gradient(to right, #ebbba7 0%, #cfc7f8 100%);
  border-radius: 6px;
  text-align: center;
}
</style>
